// sender.h
#ifndef __SENDER_H__
#define __SENDER_H__

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <sys/types.h>
#include <unistd.h>
#include <netdb.h>
#include <math.h>
#include <sys/time.h>
#include "common.h"
#include "util.h"  //util.h
#include "communicate.h"


// 函数声明
void init_sender(Sender * sender, int id);
void * run_sender(void *);
void handle_incoming_acks(Sender * sender, LLnode ** outgoing_frames_head_ptr, LLnode *head);
void handle_timedout_frames(Sender * sender, LLnode ** outgoing_frames_head_ptr);
void handle_input_cmds(Sender * sender, LLnode * outgoing_frames_head_ptr);


// 滑动窗口相关函数声明
void init_sliding_window(SlidingWindow *window, int max_size);
void add_to_window(SlidingWindow *window, WindowEntry *entry);
void remove_frame_from_window(LLnode **window, uint8_t seq_num);

#endif
